<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title><?php echo $data['add'] ? '订单添加' : '订单修改:'.$data['list'][0]['id']?></title>

<?php include VIEWS.'admin/style.html'?>

</head>

<body>

<?php include VIEWS.'admin/head.html'?>

<a name="top"></a>

<ul id="submenu">
	<li><a href='indents.php' class="current">订单查看/修改</a></li>
    <li><a href='indents.php?p=<?php echo intval($_GET['p'])?>'>待处理订单</a></li>
	<li><a href='indents.php?show=all&amp;p=<?php echo intval($_GET['p'])?>'>所有订单</a></li>
	<li><a href='indents.php?show=archive'>存档订单</a></li>
</ul>

<div id="body">

<form action="" method="post" id="updateform">
<p class="submit"><input type="submit" value="更新订单信息" style="font-weight:bold" id="submit">&nbsp;<input type="reset" value="重置" style="font-weight:bold"><br />

<br />
<div class="updatemsg" id="updatemsg" style="font-weight:bold;background-color:#FFCC66;font-size:12px;width:80%;display:none;">&nbsp;</div>
<table width="75%"><tr><td>

<?php if($data['list'][0]['camefrom']):?>
<h2>推荐人信息</h2><br />
用户ID：<a href="usersedit.php?id=<?php echo $data['list'][0]['camefrom']?>"><?php echo $data['list'][0]['camefrom']?></a> &nbsp; 返点数：<?php echo $data['list'][0]['backpoint']?>
<br /><br />
<?php endif?>

<fieldset>
<legend>订单状态</legend>
<span style="background-color:#ffff00;padding:4px"><input<?php if($data['list'][0]['stat']==0) echo ' checked'?> name="stat" type="radio" value="0" id="s0" /><label for="s0">等待付款</label></span> <b>-&gt;</b>
<span style="background-color:#CC66FF;color:#FFF; padding:4px"><input<?php if($data['list'][0]['stat']==1) echo ' checked'?> name="stat" type="radio" value="1" id="s1" /><label for="s1">等待确认</label></span> <b>-&gt;</b>
<span style="background-color:#ff0000;color:#FFF; padding:4px"><input<?php if($data['list'][0]['stat']==2) echo ' checked'?> name="stat" type="radio" value="2" id="s2" /><label for="s2">等待发货</label></span> <b>-&gt;</b>
<span style="background-color:#00ff00;padding:4px"><input<?php if($data['list'][0]['stat']==3) echo ' checked'?> name="stat" type="radio" value="3" id="s3" /><label for="s3">订单已发货</label></span> <b>-&gt;</b>
<span style="background-color:#0000ff;color:#FFF;padding:4px"><input<?php if($data['list'][0]['stat']==4) echo ' checked'?> name="stat" type="radio" value="4" id="s4" /><label for="s4">订单完成</label></span> <b>-&gt;</b>
<span style="background-color:#CCCCCC;padding:4px"><input<?php if($data['list'][0]['stat']==-1) echo ' checked'?> name="stat" type="radio" value="-1" id="s-1" /><label for="s-1">订单取消</label></span>
</fieldset>

<fieldset>
<legend>订单详情</legend>
<table cellpadding="3" width="100%" cellspacing="0" border="0">
<tr style="font-weight:bold"><td style="font-weight:bold;border-bottom:2px solid #4B75B3">&nbsp;物品名称</td><td style="font-weight:bold;border-bottom:2px solid #4B75B3">数量</td><td style="font-weight:bold;border-bottom:2px solid #4B75B3">价格</td></tr>

<?php
if (!$data['detail']['list']) die('<script>location.href="indents.php"</script>');
foreach($data['detail']['list'] as $v):
$detail_i++;
$detail_amount += $v['amount'];
?>
<tr style="font-size:14px;background-color:<?php echo $detail_i%2==0 ? '#EEEEEE' : '#F9F9F9'?>"><td style="padding:10px"><a href="/<?php echo $v['iid']?>" target="_blank"><?php echo $v['iname']?></a></td><td><?php echo $v['amount']?> X <?php echo $v['price']?></td><td>&yen; <span id="price<?php echo $v['id']?>"><?php echo $v['amount']*$v['price']?></span></td></tr>
<?php endforeach?>

<tr style="font-weight:bold;"><td style="padding-top:10px">物品费用：</td><td> - </td><td>&yen; <?php echo $data['list'][0]['sumfee'];?></td></tr>
<tr style="font-weight:bold;"><td style="padding-top:10px">费用或折扣：</td><td> - </td><td>&yen; <input name="adjustfee" size="6" type="text" value="<?php echo $data['list'][0]['adjustfee'];?>" /> </td></tr>
<tr style="font-weight:bold"><td style="border-bottom:1px dashed #BBCDF0; padding-top:10px; padding-bottom:10px">运送费用：</td><td style="border-bottom:1px dashed #BBCDF0; padding-bottom:10px">-</td><td style="border-bottom:1px dashed #BBCDF0; padding-bottom:10px">&yen; <input name="postfee" size="6" type="text" value="<?php echo $data['list'][0]['postfee'];?>" /></td></tr>
<tr style="font-weight:bold; color:#FF6240; padding-top:10px"><td>合计：</td><td style="padding-top:10px">共 <?php echo $detail_amount?> 件</td><td>&yen; <?php echo number_format($data['list'][0]['postfee']+$data['list'][0]['adjustfee']+$data['list'][0]['sumfee'], 2);?> 元</td></tr>
</table>
</fieldset>

<fieldset>
<legend>发货信息</legend>
<b style="font-size:12px">发货方式：</b><input type="text" name="posttype" value="<?php echo $data['list'][0]['posttype'];?>" />
&nbsp;
<b style="font-size:12px">物流单号：</b><input type="text" name="postnum" value="<?php echo $data['list'][0]['postnum'];?>" />

<?php
//快递查询
echo '&nbsp; &nbsp;'.post_query_link($data['list'][0]['posttype'], $data['list'][0]['postnum']);
?>
</fieldset>

<fieldset>
<legend>收货人信息</legend>

<table class="reportV2" cellpadding="5" width="80%" cellspacing="0">
<tr><td nowrap><b>收货人</b></td><td style="text-align:left"><input size="10" type="text" name="linkman" value="<?php echo $data['list'][0]['linkman']?>"></td></tr>
<tr><td nowrap><b>收货地址</b></td><td style="text-align:left"><input size="60" type="text" name="address" value="<?php echo $data['list'][0]['address']?>"></td></tr>
<tr><td nowrap><b>收货电话</b></td><td style="text-align:left"><input type="text" name="tel" value="<?php echo $data['list'][0]['tel']?>"></td></tr>
<tr><td nowrap><b>邮编</b></td><td style="text-align:left"><input type="text" name="zipcode" value="<?php echo $data['list'][0]['zipcode']?>"></td></tr>
<?php if(!$data['add']):?><tr><td nowrap><b>订单时间</b></td><td style="text-align:left"><?php echo date('Y-m-d H:i',$data['list'][0]['created'])?> &nbsp; <input type="checkbox" value="1" name="created" id="created">&nbsp;<label for="created">延时该订单</label> [<a href="javascript:void(0)" onclick="javascript:alert('订单如果在 <?php echo $CFG['indent_expire']?> 天内没有付款会被自动取消，选中这里会把下单日期更新为当前时间！')">?</a>]</td></tr><?php endif?>
<tr><td nowrap><b style="color:green">联系人</b></td><td style="text-align:left;color:green"><?php echo $data['list'][0]['cman']?></td></tr>
<tr><td nowrap><b style="color:green">联系电话</b></td><td style="text-align:left;color:green"><?php echo $data['list'][0]['cphone']?></td></tr>
<tr><td nowrap><b style="color:green">联系 Email</b></td><td style="text-align:left;color:green"><?php echo $data['list'][0]['cemail']?></td></tr>
</table>
</fieldset>

<?php if($data['list'][0]['memo']):?>
<fieldset>
<legend>订单附言</legend>
<?php echo nl2br($data['list'][0]['memo'])?><br />
</fieldset>
<?php endif?>

<?php if($data['list'][0]['needpack']>0):?>
<fieldset>
<legend>附加服务</legend>
<font color="red">需要包装服务</font>
</fieldset>
<?php endif;?>

<?php if($data['list'][0]['log']):?>
<fieldset>
<legend>订单跟踪</legend>
<?php echo nl2br($data['list'][0]['log'])?>
</fieldset>
<?php endif;?>

<?php do_action('view_admin_indentsedit_addinfo', array('data'=>&$data));?>

<p class="submit"><input type="submit" value="更新订单信息" style="font-weight:bold" id="submit">&nbsp;<input type="reset" value="重置" style="font-weight:bold">
</form>

<br /><br />

<?php if($data['list'][0]['stat'] == -1 || $data['list'][0]['stat'] == 4) echo '<script>$("updateform").disable()</script>'?>

<?php include VIEWS.'admin/runtime.html'?>

</div>

<script type="text/javascript">
Element.addClassName('am2', 'current');
</script>

</body>
</html>
